<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>

<%@ page import="com.yspay.utils.*"%>
<%@ page import="com.yspay.msg.bean.*"%>
<%@ page import="com.yspay.action.*"%>
<%@ page import="com.yspay.sample.config.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	//---------------------------------------------------------
	//银盛支付接口请求示例，商户按照此文档进行开发即可
	//---------------------------------------------------------

	//---------------生成支付订单号 开始------------------------
	//14位 当前时间 yyyyMMddHHmmss
	String currTime = DateUtil.getCurrentDate("yyyyMMddHHmmss");
	//8位日期
	String strTime = currTime.substring(8, currTime.length());
	//四位随机数
	String strRandom = DateUtil.getRandom(4) + "";
	//10位序列号,可以自行调整。
	String strReq = strTime + strRandom;
	//订单号，此处用时间加随机数生成，商户根据自己情况调整，只要保持全局唯一就行
	String orderid = currTime + strReq + strRandom;
	
	java.util.Date now = new java.util.Date();
	java.text.SimpleDateFormat format = new java.text.SimpleDateFormat(
			"yyyy-MM-dd HH:mm:ss");
	String dateNow = format.format(now);
	
	//---------------生成支付订单号 结束------------------------

	//创建支付请求对象
	S3001Web s3001 = new S3001Web();
	s3001.setMethod("ysepay.online.directpay.createbyuser");
	s3001.setPartner_id("shanghu_test");
	s3001.setTimestamp(dateNow);
	s3001.setCharset("utf-8");
	s3001.setSign_type(DirectPayConfig.SIGN_ALGORITHM);
	s3001.setNotify_url("http://baling.ngrok.cc/sft_pay/yspay/sftBgNoticeYS");
	s3001.setReturn_url("http://baling.ngrok.cc/sft_pay/yspay/sftBgNoticeYS");
	s3001.setVersion(DirectPayConfig.VERSION);
	s3001.setOut_trade_no(orderid);
	s3001.setSubject("12312312");
	s3001.setTotal_amount(100.0);
	s3001.setSeller_id("shanghu_test");
	s3001.setSeller_name("银盛支付商户测试公司");
 	s3001.setTimeout_express("96h");
 	s3001.setBusiness_code("01000010");
 	
	
	//建立请求
	if (s3001.getMethod().equals("ysepay.df.single.quick.accept")
			|| s3001.getMethod().equals("ysepay.dsf.bill.downloadurl.get")
			|| s3001.getMethod().equals("ysepay.df.single.query")) {
		
		String html = ApipaySubmit.buildRequestdf(request, s3001);
		out.println(html);
		
	} else {
		
		String html = ApipaySubmit.buildRequest(request, s3001);
		out.println(html);
	
	}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>银盛支付即时到帐程序演示</title>
</head>
<body>
	<br />
</body>
</html>
